package com.sghd.fight.module.game.service.skill.effect;

import com.sghd.fight.module.game.config.SkillConfig;
import com.sghd.fight.module.game.core.ChessBoard;
import com.sghd.fight.module.game.core.Grid;
import com.sghd.fight.module.game.core.model.Unit;
import com.sghd.fight.module.game.service.room.IRoom;
import com.sghd.fight.module.game.service.skill.Context;
import com.sghd.pojo.fight.game.SkillReport;
import com.sghd.pojo.fight.game.TargetReport;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author frank
 * @date 2018-10-23 16:23
 * @desc 重置棋盘(空间转移)
 **/
@Component
public class ResetEffect implements Effect {

    @Override
    public void execute(Context context, IRoom room, Unit owner, Unit target, Map<String, Object> ctx, SkillReport skillReport, TargetReport targetReport, SkillConfig config) {
        ChessBoard chessBoard = room.getChessBoard();
        for (Grid grid : chessBoard.getGrids()) {
            grid.remove();
        }
        chessBoard.genarete();
    }

    @Override
    public EffectType getType() {
        return EffectType.ET_RESET;
    }
}